@extends("admin.index")

@section("title","产品分类管理")

@section("content")
    <div class="page-inner">
        <div class="page-header">
            <nav class="breadcrumb">
                <div class="left row">
                    <li class="breadcrumb-item"><a href="#">产品管理</a></li>
                    <li class="breadcrumb-item active" aria-current="page">产品分类创建</li>
                </div>
                <div class="right row">
                    <li class="breadcrumb-item"><i class="fa fa-reply"></i></li>
                    <li class="breadcrumb-item active" aria-current="page"><i class="fa fa-refresh"></i> </li>
                </div>
            </nav>
        </div>

        <div class="row">
            <div class="col-md-12 grid-margin stretch-card">
                <div class="card">
                    <div class="card-header">
                        <div class="card-title">
                            <a href="{{route("admin.category.create")}}" class="btn btn-primary btn-sm btn-border">产品分类创建</a>
                        </div>
                    </div>
                    <div class="card-body">
                        @if(session()->has("data"))
                            <div class="alert alert-{{session('data')['class']}}">
                                {{ session('data')['msg'] }}
                            </div>
                        @endif
                        <div class="table-responsive">
                            <table class="table table-bordered">
                                <thead>
                                <tr>
                                    <th class="text-center">ID</th>
                                    <th class="text-center">名称</th>
                                    <th class="text-center">排序</th>
                                    <th class="text-center">操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($list as $item)
                                    <tr>
                                        <td class="text-center">{{$item->id}}</td>
                                        <td class="text-center">{{$item->level == 0 ? "" : "|"}}{{str_repeat("----",$item->level)}}{{$item->name}}</td>
                                        <td class="text-center">{{$item->sort}}</td>
                                        <td class="text-center">
                                            <a class="btn btn-success btn-xs" href="{{route("admin.category.edit",['cate'=>$item->id])}}" role="button">编辑</a>
                                            <a class="btn btn-danger btn-xs" href="{{route("admin.category.delete",['cate'=>$item->id])}}" role="button">删除</a>
                                        </td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection
